package com.xmhmyh.generalframework.framework.config;

import com.xmhmyh.generalframework.framework.yusngen.YuSnGenCode;
import com.xmhmyh.generalframework.framework.yusngen.YuSnGenUtil;
import com.xmhmyh.generalframework.project.sys.entity.Account;
import com.xmhmyh.generalframework.project.sys.entity.Dictionary;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.stereotype.Component;

import java.util.ArrayList;
import java.util.List;

/**
 * @Author: 于丁
 * @DateTime: 2020/3/10 3:27 下午
 */
@Component
@Slf4j
public class YuSnGenStart implements ApplicationRunner {
    @Autowired
    YuSnGenUtil yuSnGenUtil;

    @Override
    public void run(ApplicationArguments args) throws Exception {
        log.info("=====开始初始化流水号=====");
        List<YuSnGenCode> yuSnGenCodeList = new ArrayList<>();
        yuSnGenCodeList.add(new YuSnGenCode(Account.class, "AC", 6));
        yuSnGenCodeList.add(new YuSnGenCode(Dictionary.class, "", 6));
        yuSnGenUtil.init(yuSnGenCodeList);
        log.info("=====初始化流水号完毕=====");
    }
}
